home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / ph-faq < prev    next >
Encoding:
Text File  |  1995-07-25  |  27.1 KB  |  803 lines

  1. Subject: ph (cso nameserver) Frequently Asked Questions (FAQ)
  2. Newsgroups: info.ph,comp.infosystems.gopher,comp.infosystems.www.providers,comp.answers,news.answers
  3. From: ph-faq@wfu.edu
  4. Date: 5 Nov 1994 12:00:06 GMT
  5.  
  6. Archive-name: ph-faq
  7.  
  8. FAQ (Frequently-asked Questions) for ph (cso nameserver)
  9.  
  10. ------------------------------
  11.  
  12. Subject: Recent changes
  13.  
  14. Added to phquery section 1.4 (Oct 13, 1994)
  15.  
  16. Added new database build script 1.3 (Oct 13, 1994)
  17.  
  18. Added mirror site for ph-FAQ (Oct 13, 1994)
  19.  
  20. Added samples to Subject: 1.5 Can I run multiple databases on different 
  21. ports? (Oct 13, 1994)
  22.  
  23. Removed annoying tabs and spaces (Oct 13, 1994)
  24.  
  25. ------------------------------
  26.  
  27. Subject: Acknowledgements
  28.  
  29. The FAQ is maintained by Noel Hunter <noel@wfu.edu>.  Please send comments /
  30. corrections to ph-faq@wfu.edu.
  31.  
  32. This FAQ is automatically posted on the 5th and 20th of each month. The
  33. latest version of the FAQ is available in the following ways:
  34.  
  35. anonymous ftp:
  36. ftp://ftp.wfu.edu:/usenet/ph-FAQ
  37.  
  38. gopher to:
  39. gopher://gopher.wfu.edu/Computer information/Usenet News information
  40. maintained by Wake Forest/ph-FAQ
  41.  
  42. http://www.wfu.edu/Computer%20information/Usenet%20News%20information
  43. %20maintained%20by%20Wake%20Forest/ph-FAQ
  44.  
  45. A mirror is maintained at:
  46.  
  47. http://www.tas.gov.au/ph/contents.html
  48.  
  49. This FAQ is also mailed to the list info-ph@uxc.cso.uiuc.edu. To get on
  50. the ph mailing list, send mail to majordomo@listserv.cso.uiuc.edu with
  51. "subscribe info-ph" in the BODY (not Subject: !)
  52.  
  53. Many of these answers came from the info-ph list.  Some are paraphrased,
  54. edited, or otherwise altered, and some are not credited.  But my thanks
  55. goes out to all who have contributed to the list.  And if you see
  56. something of yours here which you want credited, let me know, and I will
  57. credit it. 
  58.  
  59. Thanks to Sandra Louie for her list of several FAQs.
  60.  
  61. ------------------------------
  62.  
  63. Subject: Submissions
  64.  
  65. The maintainer is not an expert on ph/cso.  I am relying on experts to
  66. submit FAQs and answers.  I am also relying on users of the FAQ to let me
  67. know which answers are unclear, and where there are errors or omissions.
  68. At present, this is just a start.  You can help make it more complete. 
  69.  
  70. To submit, send email to: ph-faq@wfu.edu.  If you do NOT want your name
  71. credited in the FAQ, please say so. 
  72.  
  73. ------------------------------
  74.  
  75. Subject: Contents
  76.  
  77. Section 0: What is CSO/qi/ph?
  78.  
  79. Section 1: Setting up and installing a server
  80.         1.1 Where do I get the ph / cso software?
  81.         1.2 How do I install the ph / cso software
  82.     1.3 How do I create a ph database?
  83.     1.4 How do I enable phquery for fuzzy mail addressing?
  84.     1.5 Can I run multiple databases on different ports?
  85.     1.6 How can I register my server?
  86.     1.7 How to I give everyone passwords?
  87.  
  88. Section 2: Common problems / error messages
  89.     2.1 How do I fix "Oops, lost connection to server"
  90.     2.2 How do I do searches using strings with blanks in them?
  91.     2.3 How do I limit the number of responses?
  92.     2.4 Ph is working fine for some entries, but returns "No matches to
  93.         your query" for other entries (especially new entries)
  94.         2.5 How can you get a qi server to not only compile but actually
  95.         serve queries off of a Solaris 2.X machine?
  96.  
  97. Section 3: Questions that have not been answered
  98.     3.1 To which Unix platforms has `ph' been ported?
  99.  
  100. Section 4: Other questions
  101.     4.1 What does CSO stand for?
  102.  
  103. ------------------------------
  104.  
  105. Subject: Section 0: What is CSO/qi/ph?
  106.  
  107. The CSO nameserver provides an efficient database for the storage and
  108. retrieval of a variety of information over the Internet.  Its primary use
  109. is for telephone and email directories, but it may be used to store any
  110. type of information. 
  111.  
  112. CSO is the informal name given to an electronic phonebook/nameserver
  113. database developed at the Computing and Communications Services Office at
  114. the University of Illinois by Steve Dorner and others, and since adopted
  115. by a number of other institutions. The database follows the client server
  116. model; the server maintains the actual data and runs a program called qi
  117. (query interpreter) that receives requests and sends back information. The
  118. client runs a program (often called ph) that sends requests to the server.
  119. The ph client has been ported to most major platform in use on the
  120. Internet, from Unix to Mac and PC.  Client functions are also built into
  121. many of the programs used to provide friendly interfaces to the Internet,
  122. such as gopher, World-Wide Web, and their associated clients (lynx,
  123. mosaic, etc.). 
  124.  
  125. The database is loosely structured and keyed only on people's names and on
  126. their alias, which is a unique identifier for their entry, or on other
  127. "Indexed" and "Public" fields specified in the server configuration; this
  128. permits fast lookup by name or alias, but not lookup by other criteria,
  129. such as phone number.  The server can limit the number of hits returned,
  130. to make it difficult for people to use it to make handy mailing lists.
  131. Most fields of an entry can also be concealed from public view. 
  132.  
  133. The database can be used to store assorted information in addition to
  134. people's ordinary phone book information, and can be used to store
  135. non-people information as well, such as weather data. An email address
  136. might be registered in the database for a person; in this case the
  137. nameserver performs the additional service of routing addresses of the
  138. form fullname@uiuc.edu to a registered 'real' address such as
  139. username@ux1.cso.uiuc.edu. It permits one to have a single email address
  140. at an institution, regardless of the number of host accounts they have.
  141. This conversion is actually done by yet another client called phquery and
  142. not the nameserver itself.  The nameserver in effect stores the mapping
  143. between (alias || callsign || name) and (physical email address).  phquery
  144. is designed to be called by sendmail, perform the lookup, then re-invoke
  145. sendmail with the new address obtained via nameserver lookup. 
  146.  
  147. A CSO database can also be used for security purposes, to validate entry
  148. to important services such as dial-in terminal servers. The present
  149. implementation of the terminal server security software (qtacacsd for
  150. Cisco terminal servers) does indeed query the nameserver. 
  151.  
  152. At the University of Illinois, UofI Direct, the registration service, will
  153. actually use Kerberos for authentication.  The nameserver is a very
  154. important part of this as it provides the initial set of principle names
  155. and passwords to load into Kerberos.  The qi database and the V5 Kerberos
  156. KDC will be maintained in lockstep.  Eventually only a valid Kerberos
  157. ticket will be accepted for login purposes to the UofI qi server.  The
  158. terminal server software will also be changed in the future to obtain
  159. Kerberos ticket granting tickets to verify users. 
  160.  
  161. Thanks to Stan Kerr at the Computing & Communications Services Office at U
  162. of Illinois, for providing most of the information in this section, and to
  163. Paul Pomes and Steve Dorner for reviewing it. 
  164.  
  165. ------------------------------
  166.  
  167. Subject Section 1: Setting up and installing a server
  168.  
  169. ------------------------------
  170.  
  171. Subject: 1.1 Where do I get the ph / cso software?
  172.  
  173. The software is available via anonymous ftp from:
  174.  
  175. Currently: vixen.cso.uiuc.edu, in the pub subdirectory.  However, the uiuc
  176. staff has announced that in the near future, the address will be
  177. ftp.cso.uiuc.edu. 
  178.  
  179. - qi.tar.gz (server) lives on vixen.cso.uiuc.edu, pub subdirectory.
  180. - ph.tar.gz (clients) lives on vixen.cso.uiuc.edu, pub subdirectory.
  181.  
  182. Current versions:
  183. qi: 2.3
  184. ph: 6.17
  185.  
  186. ------------------------------
  187.  
  188. Subject: 1.2 How do I install the ph / cso software?
  189.  
  190. Server
  191. ------
  192.  
  193. To install the server without reading any instructions, look in the
  194. configs directory (in qi).  Change the file "defaults" to include your
  195. domain name, desired directories, and features.  Then look for a config
  196. file for your system.  Finally, in the main qi dir, type: 
  197.  
  198. Configure systemtype
  199. make install
  200.  
  201. Finally, build the database (see 1.3, below), and modify your inetd.conf
  202. file and your services files to reference the server.  Here are sample
  203. entries: 
  204.  
  205. In services:
  206. ns                  105/tcp
  207.  
  208. If you are using NIS, run ypmake after modifying services.
  209.  
  210. In inetd.conf:
  211. ns                  stream tcp nowait root   /usr/local/lib/cso/qi qi -d -t30
  212.  
  213. After modifying inetd.conf, make the inetd reload inetd.conf:
  214.  
  215. inetd -c
  216.  
  217. Client
  218. ------
  219.  
  220. Unix: The Unix client comes as part of the server package.  The easiest
  221. way to install it is to do it as part of the server package, above.  The
  222. Configure script will automatically generate a Makefile for your system,
  223. and will make and install the ph client.  If for some reason you cannot
  224. make the entire qi package, here are the minimal steps for making the
  225. client: 
  226.  
  227. Look in the configs directory (in qi).  Change the file "defaults" to
  228. include your domain name, desired directories, and features.  Then look
  229. for a config file for your system.  Finally, in the main qi dir, type: 
  230.  
  231. Configure systemtype
  232.  
  233. Next, make the api library used by ph:
  234. cd api
  235. make
  236.  
  237. Finally, go back to the qi dir, cd to the ph dir, and do a make:
  238.  
  239. cd ..
  240. cd ph
  241. make
  242.  
  243. If all goes well, finish with:
  244. make install
  245.  
  246. Note that the client distribution (a separate from the entire qi
  247. distribution), includes a Makefile already generated for a system at uiuc.
  248. While it is possible to edit this Makefile (despite the "Do not edit"
  249. warning at the top of the file), it is much easier to make ph as a part of
  250. qi. 
  251.  
  252. Other clients:
  253.  
  254. The ph distribution comes with clients for the following systems:
  255.  
  256. a. CMS, requires TCP/IP for VM Version 1.2 or later IBM C/370 Compiler and
  257.    Runtime library (Version 1.2.0)
  258. b. DOS, with both source and executable, requires MS-DOS, PC/TCP by FTP
  259.    Software
  260. c. MAC, requires MacTCP
  261. d. Next
  262. e. PC-NFS version (for MS-DOS and SUN's PC-NFS)
  263. f. VM, in Pascal
  264. g. VMS 5.3 with Wollongong WIN/TCP 5.1
  265. h. Windows (with winsock)
  266. i. X-Windows
  267.  
  268. Some other clients not part of the distribution:
  269.  
  270. Most gopher browsers support PH queries
  271. Many World-Wide-Web browsers
  272. Some Mail packages (notably Eudora)
  273.  
  274. Other Vax/VMS clients available via anonymous ftp:
  275.   UCX:           esa.lanl.gov
  276.   UCX:           noc.macc.wisc.edu
  277.   Multinet:      icaen.llnl.gov
  278.   UCX & Mulinet: ftp.ceri.memst.edu
  279.  
  280. ------------------------------
  281.  
  282. Subject: 1.3 How do I create a ph database?
  283.  
  284. To create a database, you need to define the fields for the database,
  285. determine its size, create a text file of data to be input into the
  286. database, then run the database building programs. 
  287.  
  288. a. Defining the database
  289.  
  290. A ph database is defined by a "cnf" file.  The default file which comes
  291. with ph is "prod.cnf".  It's a good idea to start with a copy of this
  292. file, and to change as little as possible.  Some clients rely on the names
  293. of certain fields in the cnf file, so changing them can cause unforeseen
  294. problems.  The ph installation instructions specifically state that you
  295. should NOT change the following fields: 
  296.  
  297. Used in ph source code
  298. ----------------------
  299. 2:email
  300. 3:name
  301. 4:type
  302. 5:id
  303. 6:alias
  304. 7:password
  305. 8:proxy
  306. 23:nickname
  307. 25:all
  308. 30:hero
  309. 43:suppress
  310.  
  311. Used by utilities and clients
  312. -----------------------------
  313. 0:address
  314. 1:phone
  315. 9:department
  316. 10:title
  317. 11:curriculum
  318. 20:home_address
  319. 21:permanent_address
  320. 22:office_address
  321. 26:callsign
  322. 31:no_update
  323. 32:office_phone
  324. 33:home_phone
  325. 35:high_school
  326. 37:permanent_phone
  327. 42:left_uiuc
  328.  
  329. You should be able to change other fields without causing too many
  330. problems.  For each field in the file, you will see a field number, a
  331. field name, the number of bytes in the field, a descriptive name, and a
  332. list of properties for the field.  Each of these items is separated by a
  333. colon, with field entries separated by new lines.  You will probably want
  334. to change the descriptions of some of the fields, as well as their length
  335. in bytes, but you should generally leave the names and numbers alone. 
  336.  
  337. There are numerous properties you can assign to a field, and most sites
  338. will want to customize these properties.  The most commonly changed
  339. properties are as follows: 
  340.  
  341. 1. Lookup: if present, clients can search on this field
  342.  
  343. 2. Public: if present, clients can see this field.  LocalPub is a
  344. variation which allows only clients in the local domain to see the field. 
  345. If neither is present, only the system administrators and owners can see
  346. the field. 
  347.  
  348. 3. Default: If this is present, the contents of the field are returned on
  349. normal searches.  If not present, the contents are returned only when
  350. specifically requested by the client. 
  351.  
  352. 4. Change: if present, clients who have authenticated (logged in) can
  353. change the contents of the field. 
  354.  
  355. b. Creating an input file
  356.  
  357. To create an input file, you create a tab-delimited file containing the
  358. information for the database.  Each line will be composed of field
  359. numbers, a colon, the data for the field, and a tab (if another field
  360. follows).  The format looks like this: 
  361.  
  362. fieldnum:data-for-field (tab)    fieldnum:data-for-field... (new line)
  363.  
  364. Here's a simple example:
  365.  
  366. 3:Hunter, Noel C    32:759-5812     22:POBox 7408    4:p
  367. 3:Dominick, James Lyon    32:759-5261    4:p
  368.  
  369. This example has two records, one for Noel Hunter, and one for James
  370. Dominick.  Both records include data for fields 3,4 and 32, and the entry
  371. for Noel Hunter also has data for field 22. 
  372.  
  373. Notice that the entries do not have to be in any order, and that some
  374. entries can contain more fields than others.  Field 4, the "type" field,
  375. must be present if you want ph to limit the number of entries returned by
  376. searches. 
  377.  
  378. c. Building the database
  379.  
  380. Assuming that the database cnf file (see a, above) is called "prod.cnf",
  381. and the database text input file (see b, above) is called "qi.input", we
  382. can create a ph database with the following shell script (note that this
  383. version now works on a copy rather than the production database,
  384. minimizing the time that the server is down): 
  385.  
  386. #!/bin/sh
  387. # PH database build script
  388. # Designed from numerous contributions to the info-ph list
  389. # Coded by Noel Hunter (noel@wfu.edu)
  390. # Builds a PH Database from the input stored in the file qi.input.
  391. # During the build, works on a copy of the database, not the working version.
  392. # If disk space is a premium, modify the script to work on prod, not prod-new.
  393. #
  394. # The latest version of this script is available from:
  395. # ftp://ftp.wfu.edu://usenet/ph-build.sh
  396. #
  397. echo "PH database build script started..."
  398. #
  399. # cd to the cso library directory.  We assume all the cso programs  
  400. # are installed here:
  401. cd /usr/local/lib/cso
  402. #
  403. echo "Making a working copy of prod.cnf for building the new database..."
  404. cp prod.cnf prod-new.cnf
  405. #
  406. # Determine the size for the database using the "sizedb" program
  407. # that comes with the server.  You need perl to use sizedb, along
  408. # with the file primes.shar.  If you don't have these, you can hard-
  409. # code in a prime bigger than the number of indexed fields (from the
  410. # cnf file) times the number of records in your database (qi.input):
  411. echo "Calculating size..."
  412. size=`./sizedb prod-new.cnf qi.input`
  413. #
  414. # Build the database using the specifications in "prod-new.cnf", and the
  415. # data in "qi.input"
  416. echo "Executing credb..."
  417. ./credb $size prod-new
  418. echo "Executing maked..."
  419. ./maked prod-new <qi.input
  420. echo "Executing makei..."
  421. ./makei prod-new
  422. echo "Executing build..."
  423. ./build -s prod-new
  424. #
  425. # Move the new database into place:
  426. echo "Moving database into place..."
  427. mv prod-new.bdx prod.bdx
  428. mv prod-new.bnr prod.bnr
  429. mv prod-new.dir prod.dir
  430. mv prod-new.dov prod.dov
  431. mv prod-new.idx prod.idx
  432. mv prod-new.iov prod.iov
  433. mv prod-new.lck prod.lck
  434. mv prod-new.seq prod.seq
  435. #
  436. # Set permissions so that users cannot access the database directly.
  437. # We assume that the qi server is running under a login that can
  438. # access the files, if not, change "whois" below to the appropriate
  439. # user name:
  440. chown whois *
  441. chmod -R o-rwx,g-rwx *
  442. #
  443. echo "PH database build script complete."
  444.  
  445. ------------------------------
  446.  
  447. Subject: 1.4 How do I enable phquery for fuzzy mail addressing?
  448.  
  449. (contributed by Sverre Froyen, modified by Noel Hunter)
  450.  
  451. Fuzzy addressing is done by the program "phquery", part of the ph client
  452. distribution.  Fuzzy addressing allows users to send mail based on a
  453. person's real name, rather than their login ID.  Phquery performs the
  454. conversion from the real name to an email address, using the ph database. 
  455. Adding phquery is complicated, and you must be very careful or you will
  456. disrupt incoming mail.  If possible, try it out on a non-production system
  457. first. 
  458.  
  459. For phquery to work, alias must be at least "Indexed:Lookup:Public" in
  460. prod.cnf.  Default is also good to add.  Ditto for the callsign and name
  461. fields (Paul Romes). 
  462.  
  463. To make it work, first compile phquery on your machine.  It's part of the
  464. ph client distribution available from the main ftp archive (see 1.3,
  465. below). 
  466.  
  467. After compiling it, you want to make sure that it works correctly by
  468. running it in debug mode. Type, e.g.,
  469.  
  470. phquery -d -f your-address test-name < /dev/null
  471.  
  472. If it works, you are ready to install it by changing you sendmail
  473. configuration file to route incoming messages through phquery.  How you do
  474. this will vary with each version of Unix, but here is a sample. 
  475.  
  476. On most Unix systems, the file to alter is sendmail.cf.  Here are diffs of
  477. how it was done on one system: 
  478.  
  479. Adding the phquery mailer:
  480.  
  481. *** 235,240 ****
  482. --- 239,248 ----
  483.   Mlocal,       P=/bin/mail, F=flsSDFMmnP, S=10, R=20, A=mail -d $u
  484.   Mprog,        P=/bin/sh,   F=lsDFMeuP,  S=10, R=20, A=sh -c $u
  485.  
  486. + # Phquery specification
  487. +
  488. + MPH,  P=/etc/phquery, F=DFMhnmur, A=phquery $u
  489. +
  490.   S10
  491.   # None needed.
  492.  
  493. ***************
  494.  
  495. Adding the rule to invoke phquery:
  496.  
  497. *** 353,364 ****
  498. --- 361,376 ----
  499.   # Handle special cases.....
  500.   R@                    $#local $:$n                    handle <> form
  501.  
  502. + # Invoke phquery to resolve names addressed to domain (sverre)
  503. + R$+<@LOCAL>           $#PH $@$w $:$1
  504. +
  505.   # resolve the local hostname to "LOCAL".
  506.   R$*<$*$=w.LOCAL>$*    $1<$2LOCAL>$4                   thishost.LOCAL
  507.   R$*<$*$=w.uucp>$*     $1<$2LOCAL>$4                   thishost.uucp
  508.   R$*<$*$=w>$*          $1<$2LOCAL>$4                   thishost
  509.  
  510. ***************
  511.  
  512. Note that I had to add the phquery rule before the local hostname gets
  513. resolved to LOCAL.  After this point there is no way to distinguish mail
  514. to the domain from mail to the local host and a mail loop will result.
  515. Also make sure that From: line contains the hostname and not just the
  516. domain name.  Our mailer used just the domainname and I had a wonderful
  517. mail loop bouncing mail with another site because phquery could not
  518. resolve MAILER_DAEMON.  You can check your sendmail.cf file by running
  519. sendmail (by hand) with the -bt option, i.e.,
  520.  
  521. /usr/lib/sendmail -bt -C new-configuration file
  522.  
  523. and asking it to invoke the various rules, type for instance
  524.  
  525. 4,0 some-address
  526.  
  527. and it will show how rules 4 and 0 treats the address.
  528.  
  529. ***************
  530.  
  531. AN ARCHIVE of sendmail.cf diff files is maintained at:
  532.  
  533. ftp://ftp.wfu.edu/usenet/phquery-diffs/
  534.  
  535. You can use these diffs to make changes to your sendmail.cf file. 
  536. Currently, only two diffs are available: 
  537.  
  538. sendmailV8 (UCB Sendmail Version 8)
  539. sunos52    (SUN OS Version 5.2)
  540.  
  541. For IDA sendmail, the phquery program is available within the IDA
  542. distribution on vixen.cso.uiuc.edu in /mail/sendmail/uiuc. 
  543.  
  544. If you have phquery working, PLEASE send us a diff by executing the command:
  545.  
  546. diff -c sendmail.cf.clean sendmail.cf
  547.  
  548. (provided your original file is sendmail.cf.clean).  Then mail the output
  549. of the command, along with the output of "uname -a" to ph-faq@wfu.edu. 
  550.  
  551. ------------------------------
  552.  
  553. Subject: 1.5 Can I run multiple databases on different ports?
  554.  
  555. Yes.  You can use one binary (copy of the software).  On a Unix system,
  556. make multiple entries in /etc/services and /etc/inetd.conf, and use the
  557. -DATABASE option with each entry in /etc/inetd.conf to specify the desired
  558. database for that port. 
  559.  
  560. Here are some sample entries from /etc/services and /etc/inetd.conf
  561.  
  562. /etc/services:
  563. ns              105/tcp         # CCSO nameserver
  564. ns-clio         106/tcp
  565. ns-eha          107/tcp
  566.  
  567. /etc/inetd.conf:
  568. ns              stream  tcp     nowait  root    /usr/local/etc/qi qi
  569. ns-clio         stream  tcp     nowait  root    /usr/local/etc/qi qi \
  570.  -DATABASE=/usr/users/nameserv/db/clio
  571. ns-eha          stream  tcp     nowait  root    /usr/local/etc/qi qi \
  572.  -DATABASE=/usr/users/nameserv/db/eha
  573.  
  574.         (ns-clio and ns-eha are each one line, no breaks.)
  575.  
  576. (Samples contributed by Steve Madsen  <smadsen@cs.muohio.edu>)
  577.  
  578. ------------------------------
  579.  
  580. Subject: 1.6 How can I register my CSO server?
  581.  
  582. You can send a note to Joel Cooper (cooper@utopia.cc.nd.edu) or (John
  583. Norstad, j-norstad@nwu.edu) . They need to know the name of your
  584. institution as you wish it to appear in the directory, plus the domain
  585. name of your new CSO server.  Joel maintains the list used by Gopher. They
  586. try to keep their lists synchronized, so you only need to tell one of
  587. them. John had announced that he would soon stop maintaining the list for
  588. the Mac client, but has since been persuaded to continue maintaining the
  589. list. 
  590.  
  591. ------------------------------
  592.  
  593. Subject: 1.7 How to I give everyone passwords?
  594.  
  595. (contributed by Brian T. Shelden)
  596.  
  597. Password is just a field in the database, like any other. So, in your
  598. tab-separated input file (see question 1.3) just add values for the
  599. Password field in your .cnf file.  (Usually 7.)
  600.  
  601. Here's how I give everyone randomly generated passwords for the Directory
  602. of Legal Academia <gopher://gopher.law.cornell.edu/11/csodir/>. 
  603.  
  604. % mdump all > output.qi
  605. % qi2readable output.qi | givepw | readable2qi > input.qi
  606.  
  607. Now remake the database with input.qi.  Below are the scripts qi2readable,
  608. givepw, and readable2qi.  (Yes, it could be done in one script, but
  609. qi2readable and and readable2qi are useful for other things, too.)
  610.  
  611.  
  612. ==================== qi2readable ==================== (cut here)
  613. #! /usr/local/bin/perl
  614.  
  615. while (<>) {
  616.         chop;
  617.         @a = split(/\t/);
  618.         foreach $a (@a) {
  619.                 print "$a\n" if $a !~ /^\s*$/;
  620.         }
  621.         print "--------------------\n";
  622. }
  623.  
  624. ==================== readable2qi ==================== (cut here)
  625. #! /usr/local/bin/perl
  626.  
  627. while (<>) {
  628.         if (/^[-]+$/) {
  629.                 print "\t\n";
  630.         }
  631.         elsif (/\S+/) {
  632.                 chop;
  633.                 print $_, "\t";
  634.         }
  635. }
  636.  
  637. ==================== givepw ==================== (cut here)
  638. #! /usr/local/bin/perl -w
  639.  
  640. $pwnum = 7;
  641.  
  642. srand($$|time);
  643.  
  644. $hadapw = 0;
  645. while (<>) {
  646.         if (/^[\-]+$/) {
  647.                 if (! $hadapw) {
  648.                         $ascii_passwd = &pw_generate;
  649.                         print "${pwnum}:$ascii_passwd\n";
  650.                 }
  651.                 $hadapw = 0;
  652.         }
  653.         elsif (/^${pwnum}:/) {
  654.                 $hadapw = 1;
  655.         }
  656.         print;
  657. }
  658.  
  659. #------------------------------------------------------------------------------
  660. # Generate funky random password:
  661. #------------------------------------------------------------------------------
  662. sub pw_generate {
  663.         local(@passset, $rnd_passwd, $randum_num);
  664.         local($randum_num);
  665.         
  666.         @passset = ('a'..'k', 'm'..'z', 'A'..'N', 'P'..'Z', '2'..'9');
  667.         $rnd_passwd = "";
  668.         for ($i = 0; $i < 8; $i++) {
  669.                 $randum_num = int(rand($#passset + 1));
  670.                 $rnd_passwd .= @passset[$randum_num];
  671.         }
  672.  
  673.         return $rnd_passwd;
  674. }
  675.  
  676.  
  677. ------------------------------
  678.  
  679. Subject: Section 2: Common problems / error messages
  680.  
  681. ------------------------------
  682.  
  683. Subject: 2.1 How do I fix "Oops, lost connection to server"
  684.  
  685. There are many possible causes for this problem.  Here is a list of things
  686. to check: 
  687.  
  688. 1. Are the permissions set so that the login running qi (look in your
  689. "inetd.conf" file to determine the login) can read all of the files?  The
  690. permissions should look something like this (assuming the user is root): 
  691.  
  692. -rw-------   1 root     sys      3153408 Dec  6 05:03 prod.*
  693. -rwx------   1 root     sys       180224 Nov 30 11:22 qi
  694.  
  695. If qi is not running as root, you need to chown the files so that the qi
  696. user can read them, and can execute qi. 
  697.  
  698. 2. Are the ph binaries installed in the right place (specified during the
  699. make and in "inetd.conf"?  Is the ph directory accessible?  Did you move
  700. the sources after you installed (this can cause problems). 
  701.  
  702. 3. Did you build the database, and did it work (see 1.3)?
  703.  
  704. 4. Are the service names in /etc/services and /etc/inted.conf the same,
  705. and are they the same as the one specified in the makefiles? 
  706.  
  707. 5. Did you restart inetd (with inetd -c), and rebuild the NIS database (if
  708. using NIS, run ypmake), after you installed ph? 
  709.  
  710. 6. Is the prod.cnf (or other cnf) file for your database in the same
  711. directory as the database (it has to be). 
  712.  
  713. 7. If the client does not have a registered domain name, qi may be denying
  714. access.  Try compiling with the the -DNOCHECKNET option (add that to your
  715. "$Cflags" variable in the config file used to build qi and then rebuild
  716. qi.)
  717.  
  718. ------------------------------
  719.  
  720. Subject: 2.2 How do I do searches using strings with blanks in them?
  721.  
  722. (contributed by guthery@austin.slcs.slb.com)
  723.  
  724. Suppose the field you are searching is called Address and you want all the
  725. Smiths who live in "New York".  You would enter the following in the Ph
  726. command box: 
  727.  
  728. name=Smith address=New address=York
  729.  
  730. ------------------------------
  731.  
  732. Subject: 2.3 How do I limit the number of responses?
  733.  
  734. To limit the number of responses returned, you need to do two things:
  735.  
  736. 1. When compiling the server, set the "person limit", in the file
  737. qi/configs/defaults.  Look for the line: 
  738.  
  739. "PersonLimit","100",                  # max # of people to return
  740.  
  741. and set the value (100 in this example) to the desired number of entries.
  742.  
  743. 2. For all records you want to limit, you must set the "type" field to
  744. "person", or "p".  When you are building the database, just include data
  745. for the type field (field 4) with each person's entry (see the example in
  746. section 1.3). 
  747.  
  748. ------------------------------
  749.  
  750. Subject: 2.4 Ph is working fine for some entries, but returns "No matches
  751. to your query" for other entries (especially new entries)
  752.  
  753. After building a small test database then adding and modifying entries, a
  754. query to the database returns "No matches to your query".  Since the entry
  755. has just been added (and qi acknowledged that it has been added), the user
  756. knows the entry is there.  If the user queries one of the original entries
  757. in the database that has not been modified, that entry will usually be
  758. found. This problem is due to the fact that the original database is small
  759. so the SIZE returned from sizedb is small.  If SIZE is used when building
  760. the database, there is not much room for the database to grow. Use a
  761. larger value for size to avoid this problem (see Subject 1.3). 
  762.  
  763. ------------------------------
  764.  
  765. Subject: 2.5 How can you get a qi server to not only compile but actually
  766. serve queries off of a Solaris 2.X machine? 
  767.  
  768. The latest version comes with a solaris2 configuration file already.  It
  769. compiled nicely with gcc on both Solaris 2.3 and Solaris 2.2.  It works,
  770. too. :-)
  771.  
  772. Submitted by: Aleks Margan <margan@triglav.cis.yale.edu>
  773.  
  774. ------------------------------
  775.  
  776. Subject: Section 3: Questions that have not been answered.
  777.  
  778. ------------------------------
  779.  
  780. Subject: 3.1 To which Unix platforms has `ph' been ported?
  781.  
  782. ------------------------------
  783.  
  784. Subject: Section 4: Other questions
  785.  
  786. ------------------------------
  787.  
  788. Subject: 4.1 What does CSO stand for?
  789.  
  790. CSO was the acronym for the University of Illinois Computing Services
  791. Office, which is now the Computing and Communications Services Office
  792. (CCSO). 
  793.  
  794. ------------------------------
  795.  
  796. End of ph-FAQ
  797. *************
  798. --
  799. * Noel Hunter,  Academic Systems Administrator,    Wake Forest University *
  800. * email: noel@wfu.edu                            http://www.wfu.edu/~noel *
  801.  
  802.